package com.googlecode.mgwt.expenses.client;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.expenses.client.gin.ExpenseInjector;
import com.googlecode.mgwt.expenses.client.places.ExpensePlace;

public class TabletMainActivityMapper implements ActivityMapper {

	private final ExpenseInjector injector;

	public TabletMainActivityMapper(ExpenseInjector injector) {
		this.injector = injector;

	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof ExpensePlace) {
			ExpensePlace expensePlace = (ExpensePlace) place;

			if (expensePlace.isDetail()) {
				return injector.getExpenseDetailActivity();
			}

		}
		return null;

	}

}
